/**
 * 
 */
package hihocoder;

import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

/**
 * @author zhongfang
 *
 */
public class 逃离迷宫4 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int T = scanner.nextInt();
		for (int i = 0; i < T; i++) {
			int x = scanner.nextInt();
			int y = scanner.nextInt();
			int a = scanner.nextInt();
			int b = scanner.nextInt();
			if (reachable(x, y, a, b)) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
	}

	/**
	 * 由于当前x,y中较大的一方是由另一方加出来的，所以可以考虑类似辗转相除法的方法来求
	 * 
	 * @param x
	 * @param y
	 * @param a
	 * @param b
	 * @return
	 */
	private static boolean reachable(int x, int y, int a, int b) {
		if (a < b) {
			int tmp = a;
			a = b;
			b = tmp;
		}
		if (x < y) {
			int tmp = x;
			x = y;
			y = tmp;
		}
		while (a >= x && b >= y) {
			if (a == x && b == y) {
				return true;
			}
			int tmp = a % b;
			if (tmp == 0 && a != b) {
				a = b;
			} else {
				a = b;
				b = tmp;
			}
		}
		return false;
	}

	private static boolean reachable2(int x, int y, int a, int b) {
		if (x == a && y == b) {
			return true;
		}
		Queue<int[]> pos = new LinkedList<>();
		pos.add(new int[] { x, y });
		while (!pos.isEmpty()) {
			int[] cur = pos.poll();
			int newPos = cur[0] + cur[1];
			int x1 = cur[0], y1 = newPos;
			int x2 = newPos, y2 = cur[1];
			if (x1 == a && y1 == b) {
				return true;
			}
			if (!(x1 > a || y1 > b)) {
				pos.add(new int[] { x1, y1 });
			}
			if (x2 == a && y2 == b) {
				return true;
			}
			if (!(x2 > a || y2 > b)) {
				pos.add(new int[] { x2, y2 });
			}
		}
		return false;
	}

}
